package com.cy.pj.sys.controller;

import com.cy.pj.sys.pojo.SysUser;
import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class PageController {
    @RequestMapping("/{module}/{moduleUI}")
    public String doModuleUI(@PathVariable String moduleUI){
        return "sys/"+moduleUI;
    }
    @RequestMapping("/doIndexUI")
    public String doIndexUI(Model model){
        SysUser user= (SysUser) SecurityUtils.getSubject().getPrincipal();
        String loginUser=user.getUsername();
        model.addAttribute("username", loginUser);
        return "starter";
    }
    @GetMapping("/doPageUI")
    public String doPageUI(){
        return "common/page";
    }

    @GetMapping("/doLoginUI")
    public String doLoginUI(){
        return "login";
    }
}
